home *** CD-ROM | disk | FTP | other *** search
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- using System.Resources;
- using DesktopSidebar;
-
- namespace NotesEditor
- {
- /// <summary>
- /// Summary description for NoteDlg.
- /// </summary>
- public class EditNote : System.Windows.Forms.Form
- {
- private System.Windows.Forms.Button button3;
- private System.Windows.Forms.MenuItem menuItem4;
- private System.Windows.Forms.Button button1;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.TextBox txtNote;
- private System.Windows.Forms.Button btnCancel;
- private System.Windows.Forms.ContextMenu contextMenu1;
- private System.Windows.Forms.ComboBox comboBox1;
- private System.Windows.Forms.Button button2;
- private System.Windows.Forms.MenuItem menuItem1;
- private System.Windows.Forms.MenuItem menuItem3;
- private System.Windows.Forms.Button btnOK;
- private System.Windows.Forms.MenuItem menuItem2;
- private ISidebar m_sidebar;
- private bool sdn2;
- private string ic;
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.Container components = null;
-
- public EditNote(ISidebar sidebar)
- {
- //
- // Required for Windows Form Designer support
- //
- m_sidebar = sidebar;
- InitializeComponent();
- sidebar.GetTranslator().TranslateDialog2(new DialogTranslator(this),"NotesEditor.EditNote");
-
- }
-
- public string icl
- {
- get
- {
- return ic;
- }
- }
-
- public string GetNote()
- {
- return txtNote.Text;
- }
-
- public void SetNote(string sNote)
- {
- txtNote.Text = sNote;
- }
-
- public void setcolor(string icolor)
- {
- int ind = this.comboBox1.Items.IndexOf(icolor);
- this.comboBox1.SelectedIndex = ind;
- ic = this.comboBox1.SelectedItem.ToString();
- }
-
-
- public void setsdn(bool sdn)
- {
- this.sdn2=sdn;
- }
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
-
- #region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent() {
- System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(EditNote));
- this.menuItem2 = new System.Windows.Forms.MenuItem();
- this.btnOK = new System.Windows.Forms.Button();
- this.menuItem3 = new System.Windows.Forms.MenuItem();
- this.menuItem1 = new System.Windows.Forms.MenuItem();
- this.button2 = new System.Windows.Forms.Button();
- this.comboBox1 = new System.Windows.Forms.ComboBox();
- this.contextMenu1 = new System.Windows.Forms.ContextMenu();
- this.btnCancel = new System.Windows.Forms.Button();
- this.txtNote = new System.Windows.Forms.TextBox();
- this.label1 = new System.Windows.Forms.Label();
- this.button1 = new System.Windows.Forms.Button();
- this.menuItem4 = new System.Windows.Forms.MenuItem();
- this.button3 = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // menuItem2
- //
- this.menuItem2.Index = 1;
- this.menuItem2.Text = m_sidebar.GetTranslator().TranslateCommand("menuItem2");
- this.menuItem2.Click += new System.EventHandler(this.menu2Ic);
- //
- // btnOK
- //
- this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
- this.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.btnOK.Location = new System.Drawing.Point(288, 176);
- this.btnOK.Name = "btnOK";
- this.btnOK.TabIndex = 1;
- this.btnOK.Text = "OK";
- //
- // menuItem3
- //
- this.menuItem3.Index = 2;
- this.menuItem3.Text = m_sidebar.GetTranslator().TranslateCommand("menuItem3");
- this.menuItem3.Click += new System.EventHandler(this.menu3Ic);
- //
- // menuItem1
- //
- this.menuItem1.Index = 0;
- this.menuItem1.Text = m_sidebar.GetTranslator().TranslateCommand("menuItem1");
- this.menuItem1.Click += new System.EventHandler(this.menu1Ic);
- //
- // button2
- //
- this.button2.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.button2.Location = new System.Drawing.Point(8, 176);
- this.button2.Name = "button2";
- this.button2.TabIndex = 7;
- this.button2.Text = "Delete";
- this.button2.Click += new System.EventHandler(this.Button2Click);
- //
- // comboBox1
- //
- this.comboBox1.Items.AddRange(new object[] {
- m_sidebar.GetTranslator().TranslateCommand("Black"),
- m_sidebar.GetTranslator().TranslateCommand("Red"),
- m_sidebar.GetTranslator().TranslateCommand("Green"),
- m_sidebar.GetTranslator().TranslateCommand("Yellow"),
- m_sidebar.GetTranslator().TranslateCommand("Blue"),
- m_sidebar.GetTranslator().TranslateCommand("Purple"),
- m_sidebar.GetTranslator().TranslateCommand("Orange"),
- m_sidebar.GetTranslator().TranslateCommand("White"),
- m_sidebar.GetTranslator().TranslateCommand("Turquoise")});
- this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.comboBox1.Location = new System.Drawing.Point(96, 184);
- this.comboBox1.Name = "comboBox1";
- this.comboBox1.Size = new System.Drawing.Size(104, 21);
- this.comboBox1.TabIndex = 5;
- this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.ComboBox1SelectedIndexChanged);
- //
- // contextMenu1
- //
- this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.menuItem1,
- this.menuItem2,
- this.menuItem3,
- this.menuItem4});
- //
- // btnCancel
- //
- this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.btnCancel.Location = new System.Drawing.Point(368, 176);
- this.btnCancel.Name = "btnCancel";
- this.btnCancel.TabIndex = 2;
- this.btnCancel.Text = "Cancel";
- //
- // txtNote
- //
- this.txtNote.Location = new System.Drawing.Point(8, 8);
- this.txtNote.Multiline = true;
- this.txtNote.Name = "txtNote";
- this.txtNote.Size = new System.Drawing.Size(440, 160);
- this.txtNote.TabIndex = 0;
- this.txtNote.Text = "";
- this.txtNote.WordWrap = false;
- this.txtNote.ScrollBars = System.Windows.Forms.ScrollBars.Both;
- //
- // label1
- //
- this.label1.Location = new System.Drawing.Point(120, 168);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(64, 16);
- this.label1.TabIndex = 6;
- this.label1.Text = "Text Color:";
- //
- // button1
- //
- this.button1.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.button1.Location = new System.Drawing.Point(208, 176);
- this.button1.Name = "button1";
- this.button1.TabIndex = 5;
- this.button1.Text = "Options";
- this.button1.Click += new System.EventHandler(this.Button1Click);
- //
- // menuItem4
- //
- this.menuItem4.Index = 3;
- this.menuItem4.Text = m_sidebar.GetTranslator().TranslateCommand("menuItem4");
- this.menuItem4.Click += new System.EventHandler(this.menu4Ic);
- //
- // button3
- //
- this.button3.Location = new System.Drawing.Point(0, 0);
- this.button3.Name = "button3";
- this.button3.TabIndex = 0;
- //
- // EditNote
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.ClientSize = new System.Drawing.Size(458, 208);
- this.Controls.Add(this.button2);
- this.Controls.Add(this.label1);
- this.Controls.Add(this.comboBox1);
- this.Controls.Add(this.button1);
- this.Controls.Add(this.btnCancel);
- this.Controls.Add(this.btnOK);
- this.Controls.Add(this.txtNote);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
- this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
- this.Name = "EditNote";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "Edit Note";
- this.ResumeLayout(false);
- }
- #endregion
-
-
- public void Button2Click(object sender,EventArgs e)
- {
- if(sdn2==true)
- {
- string caption = m_sidebar.GetTranslator().Msg("enc");
- string question = m_sidebar.GetTranslator().Msg("dn");
- if (MessageBox.Show(question, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
- {
- this.DialogResult = DialogResult.Abort;
- this.Close();
- }
- }
- else
- {
- this.DialogResult = DialogResult.Abort;
- this.Close();
- }
- }
-
-
- void ComboBox1SelectedIndexChanged(object sender, System.EventArgs e)
- {
- ic = this.comboBox1.SelectedItem.ToString();
- }
-
-
-
-
- void Button1Click(object sender, System.EventArgs e)
- {
- contextMenu1.Show(this, button1.Location);
- }
-
- void menu1Ic(object sender, System.EventArgs e)
- {
- string hour = DateTime.Now.Hour.ToString();
- if(hour.Length<2)
- {
- hour=String.Concat("0",DateTime.Now.Hour.ToString());
- }
- string minute = DateTime.Now.Minute.ToString();
- if(minute.Length<2)
- {
- minute=String.Concat("0",DateTime.Now.Minute.ToString());
- }
- string second = DateTime.Now.Second.ToString();
- if(second.Length<2)
- {
- second=String.Concat("0",DateTime.Now.Second.ToString());
- }
- int temper = txtNote.SelectionStart;
- string temper2 = txtNote.Text;
- string temper3 = temper2.Remove(temper,temper2.Length-temper);
- string temper4 = temper2.Remove(0,temper);
- string temper5 = temper3 + hour+":"+minute+":"+second + temper4;
- this.txtNote.Text = temper5;
- }
- void menu2Ic(object sender, System.EventArgs e)
- {
- string hour = DateTime.Now.Hour.ToString();
- if(hour.Length<2)
- {
- hour=String.Concat("0",DateTime.Now.Hour.ToString());
- }
- string minute = DateTime.Now.Minute.ToString();
- if(minute.Length<2)
- {
- minute=String.Concat("0",DateTime.Now.Minute.ToString());
- }
- int temper = txtNote.SelectionStart;
- string temper2 = txtNote.Text;
- string temper3 = temper2.Remove(temper,temper2.Length-temper);
- string temper4 = temper2.Remove(0,temper);
- string temper5 = temper3 + hour+":"+minute + temper4;
- this.txtNote.Text = temper5 ;
- }
- void menu3Ic(object sender, System.EventArgs e)
- {
- string day = DateTime.Now.Day.ToString();
- if(day.Length<2)
- {
- day=String.Concat("0",DateTime.Now.Day.ToString());
- }
- string month = DateTime.Now.Month.ToString();
- if(month.Length<2)
- {
- month=String.Concat("0",DateTime.Now.Month.ToString());
- }
- int temper = txtNote.SelectionStart;
- string temper2 = txtNote.Text;
- string temper3 = temper2.Remove(temper,temper2.Length-temper);
- string temper4 = temper2.Remove(0,temper);
- string temper5 = temper3 + day+"/"+month+"/"+DateTime.Now.Year + temper4;
- this.txtNote.Text = temper5;
- }
- void menu4Ic(object sender, System.EventArgs e)
- {
- string day = DateTime.Now.Day.ToString();
- if(day.Length<2)
- {
- day=String.Concat("0",DateTime.Now.Day.ToString());
- }
- string month = DateTime.Now.Month.ToString();
- if(month.Length<2)
- {
- month=String.Concat("0",DateTime.Now.Month.ToString());
- }
- int temper = txtNote.SelectionStart;
- string temper2 = txtNote.Text;
- string temper3 = temper2.Remove(temper,temper2.Length-temper);
- string temper4 = temper2.Remove(0,temper);
- string temper5 = temper3 + month+"/"+day+"/"+DateTime.Now.Year + temper4;
- this.txtNote.Text = temper5;
- }
-
-
-
- }
-
- }
-
-